/**
 * @param {string} s
 * @return {number[]}
 */
export var diStringMatch = function (s) {
  const ans = []
  let [a, b] = [0, s.length]
  for (const c of s) {
    if (c === 'I') {
      ans.push(a++)
    } else {
      ans.push(b--)
    }
  }
  ans.push(a)
  return ans
}
